/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package ec.edu.espe.distribuidas.aseguradora.modelo;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.Size;

/**
 *
 * @author pacodell
 */
@Entity
@Table(name = "funcion", catalog = "distribuidasjsf", schema = "")
@NamedQueries({
    @NamedQuery(name = "Funcion.findAll", query = "SELECT f FROM Funcion f")})
public class Funcion implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "COD_FUNCION")
    private Integer codFuncion;
    @Size(max = 250)
    @Column(name = "DESCRIPCION_FUN")
    private String descripcionFun;
    @JoinColumn(name = "COD_CARGO", referencedColumnName = "COD_CARGO")
    @ManyToOne
    private Cargo codCargo;

    public Funcion() {
    }

    public Funcion(Integer codFuncion) {
        this.codFuncion = codFuncion;
    }

    public Integer getCodFuncion() {
        return codFuncion;
    }

    public void setCodFuncion(Integer codFuncion) {
        this.codFuncion = codFuncion;
    }

    public String getDescripcionFun() {
        return descripcionFun;
    }

    public void setDescripcionFun(String descripcionFun) {
        this.descripcionFun = descripcionFun;
    }

    public Cargo getCodCargo() {
        return codCargo;
    }

    public void setCodCargo(Cargo codCargo) {
        this.codCargo = codCargo;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (codFuncion != null ? codFuncion.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Funcion)) {
            return false;
        }
        Funcion other = (Funcion) object;
        if ((this.codFuncion == null && other.codFuncion != null) || (this.codFuncion != null && !this.codFuncion.equals(other.codFuncion))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "ec.edu.espe.distribuidas.aseguradora.modelo.Funcion[ codFuncion=" + codFuncion + " ]";
    }
    
}
